FROM nginx:1.21.4

ADD ./dist/ /usr/share/nginx/html/

RUN rm /etc/nginx/conf.d/default.conf

ADD ./nginx.conf /etc/nginx/conf.d/nginx.template

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

RUN echo 'Asia/Shanghai' >/etc/timezone 

ENV HOST http://127.0.0.1:18200/

ENV SUB_APP_BPM http://127.0.0.1:18200/

ENV SUB_APP_WP http://127.0.0.1:18200/

ENV FILE_PREVIEW http://127.0.0.1:8012/
EXPOSE 80

WORKDIR /etc/nginx/conf.d
ENTRYPOINT envsubst '${HOST},${SUB_APP_BPM},${SUB_APP_WP},${FILE_PREVIEW}' < nginx.template > default.conf && cat default.conf && nginx -g 'daemon off;'
